<div class="options">
  <a
    mat-raised-button
    href="https://github.com/tiberiuzuld/angular-gridster2/tree/master/src/app/sections/emptyCell"
    target="_blank"
    class="source-code-button"
  >
    <mat-icon>open_in_new</mat-icon>
    Source
  </a>
  <markdown [src]="'assets/emptyCell.md'"></markdown>
</div>
<div class="options-header">
  <mat-checkbox [(ngModel)]="options.enableEmptyCellClick" (ngModelChange)="changedOptions()"> Enable click to add </mat-checkbox>
  <mat-checkbox [(ngModel)]="options.enableEmptyCellContextMenu" (ngModelChange)="changedOptions()"> Enable right click to add </mat-checkbox>
  <mat-checkbox [(ngModel)]="options.enableEmptyCellDrop" (ngModelChange)="changedOptions()"> Enable drop to add </mat-checkbox>
  @if (options.enableEmptyCellDrop) {
    <div draggable="true" (dragstart)="dragStartHandler($event)">Drag me!</div>
  }
  <mat-checkbox [(ngModel)]="options.enableOccupiedCellDrop" (ngModelChange)="changedOptions()" [disabled]="!options.enableEmptyCellDrop">
    Enable drop on occupied cell
  </mat-checkbox>
  <mat-checkbox [(ngModel)]="options.enableEmptyCellDrag" (ngModelChange)="changedOptions()"> Enable drag to add </mat-checkbox>
  <mat-form-field>
    <mat-label>Drag Max Cols</mat-label>
    <input matInput [(ngModel)]="options.emptyCellDragMaxCols" type="number" (ngModelChange)="changedOptions()" />
  </mat-form-field>
  <mat-form-field>
    <mat-label>Drag Max Rows</mat-label>
    <input matInput [(ngModel)]="options.emptyCellDragMaxRows" type="number" (ngModelChange)="changedOptions()" />
  </mat-form-field>
  <button mat-mini-fab (click)="addItem()" class="add-button cols-2">
    <mat-icon>add</mat-icon>
  </button>
</div>

<gridster [options]="options">
  @for (item of dashboard; track item.id) {
    <gridster-item [item]="item">
      <div class="button-holder">
        <button mat-mini-fab (mousedown)="removeItem($event, item)" (touchstart)="removeItem($event, item)">
          <mat-icon>delete</mat-icon>
        </button>
      </div>
    </gridster-item>
  }
</gridster>
